/************************************************************************************
* CollectorItem.cpp                                                                 *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                                *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/

#include "CollectorItem.h"


QString CollectorItem::ITEM_TYPE = "CollectorItem";

using namespace Phonon;

CollectorItem::CollectorItem(QString uuid,  MediaSource *source) :
    MediaItem(uuid, source){
    m_rating = None;
    m_numPlays = 0;
    m_filePath = source->url().toLocalFile();
}


CollectorItem::CollectorItem(MediaItem* item) :
MediaItem(*item){
    m_rating = None;
    m_numPlays = 0;
}

CollectorItem::~CollectorItem() {

}


MediaRating CollectorItem::rating() {
    return m_rating;
}


void CollectorItem::setRating(MediaRating rating) {
    m_rating = rating;
}


int CollectorItem::playCount() {
    return m_numPlays;
}


void CollectorItem::setPlayCount(int playCount) {
    m_numPlays = playCount;
}


QString CollectorItem::itemType() {
    return CollectorItem::ITEM_TYPE;
}


//QString CollectorItem::uuid() {
//    return m_uuid;
//}


QString CollectorItem::tags() {
    return m_tags;
}

void CollectorItem::setTags(QString tags) {
    m_tags = tags;
}


QString CollectorItem::filePath() {
    return m_filePath;
}


//QString CollectorItem::tags() {
//    QString tagStr;
//    for(QSet<QString>::const_iterator it = m_tags.begin();
//        it != m_tags.end();
//        ++it ) {
//        tagStr.append((*it));
//    }
//    return tagStr;
//}

//void CollectorItem::setTags(QString tagStr) {
//    m_tags.clear();
//    QStringList tagList = tagStr.split(",");
//    for(int i = 0; i < tagList.size(); i++) {
//        m_tags.insert(tagList.at(i));
//    }
//}


void CollectorItem::setRemoved(bool value) {
    m_isRemoved = value;
}


bool CollectorItem::isRemoved() {
    return m_isRemoved;
}


bool CollectorItem::operator ==(CollectorItem &item) {
    return this->m_trackId == item.trackId();
}
